package moduloRemoto.pojo;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

@Entity
@Table(name="Documento")
public class Documento implements Serializable
{
	@Transient
	private static final long serialVersionUID = 1L;

	@Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(nullable=false, columnDefinition="INT(4)")
    private int idDoc;

	@Column(nullable=false, columnDefinition="VARCHAR(180)")
    private String tituloDoc;
	
	@Column(nullable=false, columnDefinition="VARCHAR(80)")
    private String tipoDoc;	
	
	@Column(nullable=false, columnDefinition="VARCHAR(80)")
    private String contentTypeDoc;	
		
	@Column(nullable=false, columnDefinition="DATE")
	@Temporal(value = TemporalType.DATE)
	private Date dataIncluDoc;
	
	@Lob
	@Column(nullable=false, columnDefinition="MEDIUMBLOB")	
	private byte[] file;
	
	@Column(nullable=false, columnDefinition="LONG")
	private int sizeFile;
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "idPro")
	private Projeto projetoDoc;
	
	
	// Construtor
	public Documento()
	{
	}

	
	// Getters and Setters
	public final int getIdDoc()
	{
		return idDoc;
	}

	public final void setIdDoc(int idDoc)
	{
		this.idDoc = idDoc;
	}

	public final String getTituloDoc()
	{
		return tituloDoc;
	}

	public final void setTituloDoc(String tituloDoc)
	{
		this.tituloDoc = tituloDoc;
	}

	public final String getTipoDoc()
	{
		return tipoDoc;
	}

	public final void setTipoDoc(String tipoDoc)
	{
		this.tipoDoc = tipoDoc;
	}
	
	public String getContentTypeDoc()
	{
		return contentTypeDoc;
	}

	public void setContentTypeDoc(String contentTypeDoc)
	{
		this.contentTypeDoc = contentTypeDoc;
	}

	public final Date getDataIncluDoc()
	{
		return dataIncluDoc;
	}

	public final void setDataIncluDoc(Date dataIncluDoc)
	{
		this.dataIncluDoc = dataIncluDoc;
	}
	
	public byte[] getFile()
	{
		return file;
	}

	public void setFile(byte[] file)
	{
		this.file = file;
	}

	public int getSizeFile()
	{
		return sizeFile;
	}

	public void setSizeFile(int sizeFile)
	{
		this.sizeFile = sizeFile;
	}
	
	public Projeto getProjetoDoc()
	{
		return projetoDoc;
	}
	
	public void setProjetoDoc(Projeto projetoDoc)
	{
		this.projetoDoc = projetoDoc;
	}
}